﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebShop.Classes.DataSource
{
    /// <summary>
    /// Create object for data work
    /// </summary>
    public class DataSourceFactory
    {
        /// <summary>
        /// Data source constuctor
        /// </summary>
        /// <param name="type">Data source</param>
        /// <returns>Datasource class</returns>
        public static IDataSource Contruct(DataSoureType type = ParameterConstants.DataSourceTypeDefault)
        {
            IDataSource result;
            string language = ConfigStorage.Language;

            switch (type)
            {
                case DataSoureType.Mock:
                    result = new Driver.Mock(language);
                    break;
                case DataSoureType.Wcf:
                    result = new Driver.Wcf(language);
                    break;
                default:
                    throw new NotImplementedException();
            }

            return result;
        }
    }
}